const getLocalByIP = () => {
  return new Promise((resovle, reject) => {
    let key = "OJYBZ-6SZKU-443VI-2HC46-5SGST-Z2FG3";
    wx.request({
      url: `https://apis.map.qq.com/ws/location/v1/ip?key=${key}`,
      success: (res) => {
        resovle(res.data);
        if (res.data.status != 0) {
          console.warn("location/v1/ip?key=" + key + "==" + res.data.message);
        }
      },
      fail: (err) => {
        reject(err);
      },
    });
  });
};

module.exports = getLocalByIP;
